//
//  KFSearchResultViewController.m
//  SearchHistory
//
//  Created by VS on 16/5/9.
//  Copyright © 2016年 VS. All rights reserved.
//

#import "KFSearchResultViewController.h"

@interface KFSearchResultViewController ()

@end

@implementation KFSearchResultViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    self.navigationController.navigationItem.title = self.text;
    self.title = @"搜索结果";
}

//重写父类的方法

- (void)loadDatas{
    
    FTYUser *user = [FTYUser sharedUser];
    NSString *memberID = @"";
    if (user.userID) {
        memberID = user.userID;
    } else {
        memberID = @"0";
    }
    
    [FTYHTTPManager postInfoWithSubUrl:[NSString stringWithFormat:@"/shop/ybkapi.php?act=ybkapi&op=goodslist&member_id=%@&keyword=%@", memberID, _searchKeyWord] parameters:nil block:^(id result, NSError *error) {
        if (!error) {
            
            DLog(@"====%@", result);
            FTYBaseModel *baseModel = [[FTYBaseModel alloc] init];
            baseModel = [FTYBaseModel mj_objectWithKeyValues:result];
            FTYErrorInfoModel *errorInfo = [FTYErrorInfoModel mj_objectWithKeyValues:baseModel.err];
            
            if (0 == errorInfo.errorcode) {
                
                [self.categoryListModels removeAllObjects];
                [self.categoryListModels addObjectsFromArray:[FTYBaseModel mj_objectWithKeyValues:result].info];
                
                
                [self.categoryListTV reloadData];
            } else {
                [[FTYToastView alloc] addTitle:errorInfo.errorinfo addView:self.view];
            }
        }  else {
            
            NSLog(@"分类列表请求错误：%@", error);
        }
    }];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
